import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:lcapp/api/request/response_data.dart';
import 'package:lcapp/basic/user_info.dart';
import 'package:lcapp/config/const_config.dart';
import 'package:lcapp/widget/asr_app_bar.dart';
import 'package:lcapp/widget/asr_cache_image.dart';

class MInSmrzDetailPage extends StatefulWidget {
  final Map arguments;
  const MInSmrzDetailPage({Key? key, required this.arguments}) : super(key: key);

  @override
  _MInSmrzDetailPageState createState() => _MInSmrzDetailPageState();
}

class _MInSmrzDetailPageState extends State<MInSmrzDetailPage> {

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: bgColor,
      appBar: AsrAppBar(
        titleText: '详情',

      ),
      body:Container(
        margin: EdgeInsets.only(left: 40.w,right: 40.w,top: 60.w),
        child: Column(
          children: [
            Stack(
              children: [
                Container(
                  child: Container(
                    margin: EdgeInsets.only(top: 80.w),
                    padding: EdgeInsets.only(left: 40.w,right: 40.w,bottom: 60.w,top: 160.w),
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(10.w),
                    ),
                    child: Column(
                      children: [
                        Container(
                          child: Text('资料信息',style: TextStyle(
                              color: Colors.black,
                              fontSize: 38.sp,
                              fontWeight: FontWeight.w600
                          ),textAlign: TextAlign.left,),
                          alignment: Alignment.centerLeft,
                          margin: EdgeInsets.only(bottom: 70.w),
                        ),
                        Container(
                          margin: EdgeInsets.only(bottom: 60.w),
                          child: Row(
                            children: [
                              Text('姓名',style: TextStyle(
                                  color: Colors.black,
                                  fontSize: 30.sp,
                                  fontWeight: FontWeight.w600
                              ),),
                              SizedBox(width: 40.w,),
                              Expanded(child: Text('${userInfo.ocrInfo?.userName??''}',style: TextStyle(
                                  color: Color(0xff333333),
                                  fontSize: 30.sp
                              ),textAlign: TextAlign.right,)),
                            ],
                          ),
                        ),
                        Container(
                          margin: EdgeInsets.only(bottom: 60.w),
                          child: Row(
                            children: [
                              Text('证件类型',style: TextStyle(
                                  color: Colors.black,
                                  fontSize: 30.sp,
                                  fontWeight: FontWeight.w600
                              ),),
                              SizedBox(width: 40.w,),
                              Expanded(child: Text('身份证号',style: TextStyle(
                                  color: Color(0xff333333),
                                  fontSize: 30.sp
                              ),textAlign: TextAlign.right,)),
                            ],
                          ),
                        ),
                        Container(
                          margin: EdgeInsets.only(bottom: 60.w),
                          child: Row(
                            children: [
                              Text('证件号码',style: TextStyle(
                                  color: Colors.black,
                                  fontSize: 30.sp,
                                  fontWeight: FontWeight.w600
                              ),),
                              SizedBox(width: 80.w,),
                              Expanded(child: Text('${userInfo.ocrInfo?.idNumber}',style: TextStyle(
                                  color: Color(0xff333333),
                                  fontSize: 30.sp
                              ),textAlign: TextAlign.right,)),
                            ],
                          ),
                        ),
                        Container(
                          margin: EdgeInsets.only(top: 20.w),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              Image.asset('assets/min/xm_info.png',width: 30.w,),
                              SizedBox(width: 4.w,),
                              Text('若账号信息已变更，点击修改信息进行更换 。',style: TextStyle(
                                  color: Color(0xff767676),
                                  fontSize: 27.sp
                              )),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
                Positioned(
                  child: ClipRRect(
                    borderRadius: BorderRadius.circular(180.w),
                    child: Container(
                      width: 180.w,
                      height: 180.w,
                      decoration: BoxDecoration(
                          color: Colors.white,
                        border: Border.all(color: bgColor,width: 1)
                      ),
                      alignment: Alignment.center,
                      child: ClipRRect(
                        borderRadius: BorderRadius.circular(180.w),
                        child: ASRCacheImage(
                          width: 160.w,
                          height: 160.w,
                          fit: BoxFit.fitWidth,
                          image: userInfo.img??'',
                        ),
                      ),
                    ),
                  ),
                  left: (1.sw-80.w-180.w)*0.5,
                )
              ],
            ),

            GestureDetector(
              onTap: (){
                Navigator.of(context).pushNamed('MInSmrzPage').then((value){
                  refreshUserInfo(refreshBlock: (){
                    setState(() {});
                  });
                });
              },
              child: Container(
                margin: EdgeInsets.only(top: 40.w),
                alignment: Alignment.center,
                height: 110.w,
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(10.w)
                ),
                child: Text('修改信息',style: TextStyle(
                  color: Color(0xffFA6E28),
                  fontSize: 34.sp
                ),),
              ),
            )
          ],
        ),
      ),
    );
  }
}
